#!/usr/bin/env python
# -*- coding:utf-8 -*-

def wrapper(func):
    def result():
        print 'before'
        func()
        print 'after'
    return result
'''
def wrapper(func):
    print "bef"
    func()
    print "after"
    return func
'''
@wrapper
def foo():
    print 'foo'

@wrapper
def test():
    print "test"
test()